\documentclass[a4paper,11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{listings}

\lstset{
  numbers=none,
  tabsize=2,
  breaklines=false,
  basicstyle=\fontsize{8}{10}\selectfont
}

\title{Buzzword Bingo}
\author{
Tim Braner\\
Jochen Gutermann\\
Steffen Henn\"{o}ffer\\
Sven Sch\"{o}nung\\
Sebastian Tschirpke
}

\begin{document}

\maketitle
\tableofcontents

\chapter{Einleitung}

\chapter{\"{U}berblick}

\chapter{Server}

\section{Medientypen}

\subsection{application/buzzwordbingo.resources+xml}

\begin{lstlisting}
<resources>
	<link rel="self" href="/rest/" />
	<games>
		<link rel="self" href="/rest/games/" />
	</games>
	<players>
		<link rel="self" href="/rest/players/" />
	</players>
	<boards>
		<link rel="self" href="/rest/boards/" />
	</boards>
</resources>
\end{lstlisting}

\subsection{application/buzzwordbingo.players+xml}

\begin{lstlisting}
<players from="100" to="199">
	<link rel="self" href="/rest/players/?from=100&to=199" />
	<link rel="prev" href="/rest/players/?from=0&to=99" />
	<link rel="next" href="/rest/players/?from=200&to=299" />
	<player>
		<link rel="self" href="/rest/players/foo/" /> 
		<name>foo</name> 
		<loginTime>1301662134113</loginTime>
	</player>
	[...]
</players>
\end{lstlisting}

\subsection{application/buzzwordbingo.player+xml}

\begin{lstlisting}
<player>
		<link rel="self" href="/rest/players/foo/" /> 
		<name>foo</name> 
		<loginTime>1301662134113</loginTime>
		<games>
			<game>
				<link rel="self" href="/rest/games/Spiel_1/"> 
				<id>Spiel_1</id> 
				<title>Spiel 1</title>
				<creationTime>1301662198434</creationTime>
			</game>
			[...]
		</games>
		<boards>
			<board>
				<link rel="self" href="/rest/boards/d102c080-5c5c-11e0-80e3-0800200c9a66/" />
			</board>
			[...]
		</boards>
</player>
\end{lstlisting}

\subsection{application/buzzwordbingo.games+xml}

\begin{lstlisting}
<games from="100" to="199">
	<link rel="self" href="/rest/games/?from=100&to=199" />
	<link rel="prev" href="/rest/games/?from=0&to=99" />
	<link rel="next" href="/rest/games/?from=200&to=299" />
	<game>
		<link rel="self" href="/rest/games/Spiel_1/" />
		<id>Spiel_1</id> 
		<title>Spiel 1</title>
		<creationTime>1301662198434</creationTime>
		<owner>
			<link rel="self" href="/rest/players/foo/" />
			<name>foo</name>
		</owner>
		<winner>
			<link rel="self" href="/rest/players/bar/" />
			<name>bar</name>
		</winner>
	</game>
</games>
\end{lstlisting}

\subsection{application/buzzwordbingo.game+xml}

\begin{lstlisting}
<game>
	<link rel="self" href="/rest/games/Spiel_1">
	<id>Spiel_1</id> 
	<title>Spiel 1</title>
	<size>5</size>
	<description>Kurze Beschreibung</description>
	<creationTime>1301662198434<creationTime>
	<owner>
		<link rel="self" href="/rest/players/foo/" />
		<name>foo</name>
	</owner>
	<winner>
		<link rel="self" href="/rest/players/bar/" />
		<name>bar</name>
	</winner>
	<buzzwords>
  	<buzzword>Ajax</buzzword>
		<buzzword>Java</buzzword>
		<buzzword>REST</buzzword>
  	<buzzword>XML</buzzword>
  	<buzzword>Tomcat</buzzword>
  	<buzzword>Spring MVC</buzzword>
	 	<buzzword>HATEOAS</buzzword>
	 	[...]
	</buzzwords>
	<players>
		<player>
			<link rel="self" href="/rest/players/bar/" />
			<name>bar</name>
		</player>
		<player>
			<link rel="self" href="/rest/players/quux/" />
			<name>quux</name>
		</player>
	  [...]
	</players>
	<boards>
		<board>
			<link rel="self" href="/rest/players/d102c080-5c5c-11e0-80e3-0800200c9a66/" />
		</board>
		<board>
			<link rel="self" href="/rest/players/550e8400-e29b-41d4-a716-446655440000/" />
		</board>
    [...]
	</boards>
</game>
\end{lstlisting}

\subsection{application/buzzwordbingo.boards+xml}

\begin{lstlisting}
<boards from="100" to="199">
	<link rel="self" href="/rest/boards/?from=100&to=199" />
	<link rel="prev" href="/rest/boards/?from=0&to=99" />
	<link rel="next" href="/rest/boards/?from=200&to=299" />
	<board>
		<link rel="self" href="/rest/boards/d102c080-5c5c-11e0-80e3-0800200c9a66/" />
		<game>
			<link rel="self" href="/rest/game/foo/" />
			<id>foo</id>
		</game>
		<player>
			<link rel="self" href="/rest/player/bar/" />
			<name>bar</name>
		</player>
	</board>
	[...]
</boards>
\end{lstlisting}

\subsection{application/buzzwordbingo.board+xml}

\begin{lstlisting}
<board>
  <link rel="self" href="/rest/boards/d102c080-5c5c-11e0-80e3-0800200c9a66/" />
	<size>5</size>
	<game>
	 	<link rel="self" href="/rest/games/Spiel_1" />
	</game>
	<player>
		<link rel="self" href="/rest/players/foo/" />
	</player>
	<buzzwords>
		<buzzword>
			<row>0</row>
			<col>0</col>
			<text>XML</text>
			<marked>true</marked>
		</buzzword>
		[...]
   	<buzzword>
			<row>4</row>
			<col>4</col>
			<text>Ajax</text>
			<marked>false</marked>
		</buzzword>
	</buzzwords>
</board>
\end{lstlisting}

\section{REST API}

\lstset{
  aboveskip=-2ex,
  belowskip=-2ex
}

\subsection{Liste aller Resourcen}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/}\\
\hline
Method & \texttt{GET}\\
\hline
HTTP Auth & Nein\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{200 OK} & Erfolgreich\\
\end{tabular}\\
\hline
Returns & \texttt{application/buzzwordbingo.resources+xml}\\
\end{tabular}

\subsection{Erstellen eines Spielers}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/players/}\\
\hline
Method & \texttt{POST}\\
\hline
HTTP Auth & Nein\\
\hline
Body & \begin{lstlisting}
<player>
  <name>foobar</name>
  <password>43718ae7-fcc7-4b97-a774-74bb6d7a48fa</password>
</player>
\end{lstlisting}
\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{201 CREATED} & Spieler erstellt\\
\texttt{409 CONFLICT} & Der Spieler existiert bereits\\
\end{tabular}\\
\hline
Header & \texttt{Location}\\
\end{tabular}

\subsection{Liste aller Spieler}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/players/}\\
\hline
Querystring & \begin{tabular}{@{}l l}
\texttt{sort=[name|login]} & Sortierung festlegen\\
\texttt{order=[asc|desc]} & Reihenfolge festlegen\\
\texttt{from=\emph{i}} & Startindex\\
\texttt{to=\emph{j}} & Endindex\\
\texttt{game=\emph{id}} & Filtern nach Spiel\\
\end{tabular}\\
\hline
Method & \texttt{GET}\\
\hline
HTTP Auth & Nein\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{200 OK} & Erfolgreich\\
\end{tabular}\\
\hline
Returns & \texttt{application/buzzwordbingo.players+xml}\\
\end{tabular}

\subsection{Informationen zu einem Spieler}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/players/\emph{name}/}\\
\hline
Method & \texttt{GET}\\
\hline
HTTP Auth & Nein\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{200 OK} & Erfolgreich\\
\texttt{404 NOT FOUND} & Spieler existiert nicht\\
\end{tabular}\\
\hline
Returns & \texttt{application/buzzwordbingo.player+xml}\\
\end{tabular}

\subsection{Entfernen eines Spielers}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/players/\emph{name}/}\\
\hline
Method & \texttt{DELETE}\\
\hline
HTTP Auth & Ja\\
\hline
\hline
Status Codes &  \begin{tabular}{@{}l l}
\texttt{204 NO CONTENT} & Spieler entfernt\\
\texttt{403 FORBIDDEN} & Keine Berechtigung\\
\end{tabular}\\
\end{tabular}

\subsection{Erstellen eines Spiels}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/games/}\\
\hline
Method & \texttt{POST}\\
\hline
HTTP Auth & Ja\\
\hline
Body & \begin{lstlisting}
<game>
	<title>Titel des zu erstellenden Spiels</title>
	<size>3</size>
	<description>Eine kurze Beschreibung des Spiels (optional)</description>
	<buzzwords>
		<buzzword>Ajax</buzzword>
		<buzzword>Java</buzzword>
		<buzzword>REST</buzzword>
  	<buzzword>XML</buzzword>
  	<buzzword>Tomcat</buzzword>
  	<buzzword>Spring MVC</buzzword>
	 	<buzzword>HATEOAS</buzzword>
	 	[...]
	</buzzwords>
</game>
\end{lstlisting}
\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{201 CREATED} & Spiel erstellt\\
\texttt{403 FORBIDDEN} & Keine Berechtigung für diesen Spieler\\
\end{tabular}\\
\hline
Header & \texttt{Location}\\
\end{tabular}

\subsection{Liste aller Spiele}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/games/}\\
\hline
Querystring & \begin{tabular}{@{}l l}
\texttt{sort=[title|creation|size]} & Sortierung festlegen\\
\texttt{order=[asc|desc]} & Reihenfolge festlegen\\
\texttt{from=\emph{i}} & Startindex\\
\texttt{to=\emph{j}} & Endindex\\
\texttt{player=\emph{id}} & Filtern nach Spieler\\
\end{tabular}\\
\hline
Method & \texttt{GET}\\
\hline
HTTP Auth & Nein\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{200 OK} & Erfolgreich\\
\end{tabular}\\
\hline
Returns & \texttt{application/buzzwordbingo.games+xml}\\
\end{tabular}


\subsection{Informationen zu einem Spiel}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/players/\emph{id}/}\\
\hline
Method & \texttt{GET}\\
\hline
HTTP Auth & Nein\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{200 OK} & Erfolgreich\\
\texttt{404 NOT FOUND} & Spiel existiert nicht\\
\end{tabular}\\
\hline
Returns & \texttt{application/buzzwordbingo.game+xml}\\
\end{tabular}

\subsection{Hinzuf\"{u}gen eines Spielers zu einem Spiel}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/games/\emph{id}/players/}\\
\hline
Method & \texttt{POST}\\
\hline
HTTP Auth & Ja\\
\hline
Body & \begin{lstlisting}
<player>
  <name>foo</name>
</player>
\end{lstlisting}
\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{201 CREATED} & Spieler beigetreten\\
\texttt{404 NOT FOUND} & Das Spiel existiert nicht\\
\texttt{403 FORBIDDEN} & Keine Berechtigung f\"{u}r den Spieler\\
\texttt{409 CONFLICT} & Spieler ist dem Spiel bereits beigetreten\\
\end{tabular}\\
\end{tabular}

\subsection{Entfernen eines Spielers aus einem Spiel}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/games/\emph{id}/players/\emph{name}}\\
\hline
Method & \texttt{DELETE}\\
\hline
HTTP Auth & Ja\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{204 NO CONTENT} & Spieler aus Spiel entfernt\\
\texttt{404 NOT FOUND} & Das Spiel existiert nicht/Spieler nicht im Spiel\\
\texttt{403 FORBIDDEN} & Keine Berechtigung f\"{u}r den Spieler\\
\end{tabular}\\
\end{tabular}

\subsection{Liste aller Boards}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/boards/}\\
\hline
Querystring & \begin{tabular}{@{}l l}
\texttt{from=\emph{i}} & Startindex\\
\texttt{to=\emph{j}} & Endindex\\
\texttt{player=\emph{name}} & Filtern nach Spieler\\
\texttt{game=\emph{id}} & Filtern nach Spiel\\
\end{tabular}\\
\hline
Method & \texttt{GET}\\
\hline
HTTP Auth & Nein\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{200 OK} & Erfolgreich\\
\end{tabular}\\
\hline
Returns & \texttt{application/buzzwordbingo.boards+xml}\\
\end{tabular}

\subsection{Informationen zu einem Board}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/boards/\emph{id}/}\\
\hline
Method & \texttt{GET}\\
\hline
HTTP Auth & Nein\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{200 OK} & Erfolgreich\\
\texttt{404 NOT FOUND} & Board existiert nicht\\
\end{tabular}\\
\hline
Returns & \texttt{application/buzzwordbingo.board+xml}\\
\end{tabular}

\subsection{\"{A}ndern eines Boards}

\begin{tabular}{l|p{3.5in}}
URL & \texttt{/rest/boards/\emph{id}/}\\
\hline
Method & \texttt{PUT}\\
\hline
HTTP Auth & Ja\\
\hline
Body & \begin{lstlisting}
<board>
		<buzzwords>
			<buzzword>
			  <row>0</row>
			  <col>0</col>
			  <text>foo</text>
			  <marked>true</true>
			</buzzword>
			[...]
			<buzzword>
			  <row>4</row>
			  <col>4</col>
			  <text>bar</text>
			  <marked>false</true>
			</buzzword>
		</buzzwords>
</board>
\end{lstlisting}\\
\hline
\hline
Status Codes & \begin{tabular}{@{}l l}\texttt{204 NO CONTENT} & Board ge\"{a}ndert\\
\texttt{404 NOT FOUND} & Das Board existiert nicht\\
\end{tabular}\\
\end{tabular}

\chapter{Clients}

\section{Web-Client}

\section{Java-Client}

\end{document}